import React from 'react' // 引入react
import ReactDOM from 'react-dom/client' // 引入react-dom
import { HashRouter } from "react-router-dom" // 路由哈希模式
import App from './App' // 引入App组件
import store from "./store/store" // 引入redux
import { Provider } from 'react-redux' // 引入react-redux

// 渲染
const root = ReactDOM.createRoot(document.getElementById('root'))
// 简单封装render
const render = ()=>{
  return root.render(
    // <React.StrictMode>
    <HashRouter>
      {/* Provider组件包裹住App,使用store={store} 注入到当前应用中 */}
      <Provider store={store}>
        <App />
      </Provider>
    </HashRouter>
    // </React.StrictMode>
  )
}

render()

// store订阅  store.subscribe(()=>{})
store.subscribe(render)
